<template>
    <div class="homeList">
        <x-header :left-options="{showBack:false}">首页</x-header>
        <product-list :demoData="demoData"></product-list>
        <div class="more" @click="moreData" v-if="allData&&allData.length>6">加载更多</div>
    </div>
</template>

<script>
    import productList from '../common/product-list';
    import {DataService} from "../../axios/api";
    export default {
        name:'home-list',
        data(){
            return{
                imgSrc:require('../../../src/assets/img/1.jpg'),
                allData:[],
                demoData:[],
            }
        },
        components:{
            productList,
        },
        methods:{
            moreData(){
                this.$router.push('/alleq')
            }
        },
        mounted() {
            DataService.post('searchEquipmentController/getEquipment').then(res=>{
                this.allData = res.data;
                this.demoData = res.data.slice(0,6)
            }).catch(err=>{
                console.log(err)
            })
        }
    }
</script>
<style lang="less" scoped>
    @import '../common/css/home.less';
    /deep/ .vux-header{
        background: @Homecolor;
    }
    /deep/ ul.list{
        display: flex;
        margin-top: 45px;
    }
    .more{
        display: block;
        font-size: 14px;
        cursor: pointer;
        width: 100%;
        text-align: center;
        line-height: 40px;
        color: #333;
    }
</style>
